package huawei.nk;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class NKSort {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            int[] data = new int[n];
            for (int i = 0; i < n; i++) {
                data[i] = scanner.nextInt();
            }
            ArrayList<Integer> res = sort(data);
            for(int a:res){
                System.out.println(a);
            }
        }
    }

    private static ArrayList<Integer> sort(int[] data) {
        ArrayList<Integer> res = new ArrayList<>();
        for (int num : data) {
            insert(res, num);
        }
        return res;
    }

    private static void insert(ArrayList<Integer> res, int num) {
        if(res.size()==0){
            res.add(num);
        }
        int left = 0;
        int right = res.size() - 1;
        while (left < right) {
            int mid = (left + right) / 2;
            if (res.get(mid) == num) {
                return;
            }
            if (res.get(mid) < num) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
        if (res.get(left) == num) {
            return;
        }
        if (res.get(left) < num) {
            if (left + 1 == res.size()) {
                res.add(num);
            } else {
                res.add(left + 1, num);
            }
        } else {
            res.add(left, num);
        }
        System.out.println(Arrays.toString(res.toArray()));
    }
}
